<template>
	<view class="main">
		<view class="navi-bar">
			<view class="navi-back" @click="goBack">
				<
			</view>
			<view class="navi-title">
				用户反馈页面
			</view>
			<view class="navi-history">
				历史反馈
			</view>
		</view>
		<view class="fde-first">
			<view class="first-title">
				{{FeedDetailsList.tagTitle.content}}
			</view>
			<view class="first-item">
				<view class="item-left" :class="{selected: btn1Click}" :data-product="FeedDetailsList.tags.content[0]" @click="ChangeClick">
					{{FeedDetailsList.tags.content[0]}}
				</view>
				<view class="item-right" :class="{selected: btn2Click}" :data-product="FeedDetailsList.tags.content[1]" @click="ChangeClick">
					{{FeedDetailsList.tags.content[1]}}
				</view>
			</view>
		</view>
		<view class="fde-second">
			<view class="second-title">
				{{FeedDetailsList.descriptionTitle.content}}
			</view>
			<view class="second-item">
				<input type="text" class="item-ipt" :placeholder="FeedDetailsList.description.content"/>
			</view>
		</view>
		<view class="fde-third">
			<view class="third-title">
				{{FeedDetailsList.contactTitle.content}}
			</view>
			<view class="third-item">
				<input type="tel" class="third-ipt" :placeholder="FeedDetailsList.contact.content"/>
			</view>
		</view>
		<view class="faq-btn" @click="naviTo">
			{{FeedDetailsList.submitButton.content}}
		</view>
	</view>
</template>

<script>
	import {
		http
	} from '../../untils/http.js'
	
	const url = 'feedback'
	
	export default {
		data() {
			return {
				FeedDetailsList: [],
				// 判断所点击的按钮
				btn1Click: true,
				btn2Click: false
			}
		},
		created() {
			http(url).then(res => {
				this.FeedDetailsList = res.data.feedback
				console.log(this.FeedDetailsList);
			})
		},
		methods: {
			ChangeClick(e) {
				// console.log(e);
				let product = e.currentTarget.dataset.product
				console.log(product);
				switch (product) {
					case this.FeedDetailsList.tags.content[0]:
					this.btn1Click = true
					this.btn2Click = false
					break
					case this.FeedDetailsList.tags.content[1]:
					this.btn1Click = false
					this.btn2Click = true
					break
				}
			},
			goBack() {
				// 返回上一级并刷新当前页面
				this.$router.go(-1)
			}
		}
	}
</script>

<style lang="scss">
	* {
		box-sizing: border-box;
	}
	
	.main {
		position: relative;
		background-color: #f1f1f1;
		height: 1300rpx;
	}
	
	.navi-bar {
		padding: 0 10px;
		display: flex;
		justify-content: space-between;
		align-items: center;
		height: 80rpx;
		line-height: 80rpx;
		background-color: #fff;
		border-bottom: 1px solid #dadada;
		
		.navi-back {
			color: #cc2225;
		}
		
		.navi-title {
			margin-left: 20px;
			font-size: 16px;
		}
		
		.navi-history {
			font-size: 12px;
			color: #cc2225;
		}
	}
	
	.fde-first {
		width: 750rpx;
		
		.first-title {
			padding: 10px;
			width: 100%;
			font-size: 14px;
			color: #666666;
		}
		
		.first-item {
			display: flex;
			align-items: center;
			width: 100%;
			height: 200rpx;
			// line-height: 200rpx;
			background-color: #fff;
			font-size: 14px;
			
			.item-left {
				margin-left: 20px;
				padding: 10px;
				border: 1px solid #5f5f5f;
				border-radius: 5px;
				background-color: #f1f1f1;
				color: #5e5e5e;
				
				&.selected {
					border: 1px solid #2187d5;
					color: #2187d5;
				}
			}
			
			.item-right {
				margin-left: 20px;
				padding: 10px;
				border: 1px solid #5f5f5f;
				border-radius: 5px;
				background-color: #f1f1f1;
				color: #5e5e5e;
				
				&.selected {
					margin-left: 20px;
					padding: 10px;
					border: 1px solid #2187d5;
					border-radius: 5px;
					background-color: #f1f1f1;
					color: #2187d5;
				}
			}
		}
	}
	
	.fde-second {
		width: 750rpx;
		
		.second-title {
			padding: 10px;
			width: 100%;
			font-size: 14px;
			color: #666666;
		}
		
		.second-item {
			width: 100%;
			height: 300rpx;
			background-color: #fff;
			
			.item-ipt {
				padding: 5px 10px;
				height: 70rpx;
				font-size: 14px;
			}
		}
	}
	
	.fde-third {
		width: 750rpx;
		
		.third-title {
			padding: 10px;
			width: 100%;
			font-size: 14px;
			color: #666666;
		}
		
		.third-item {
			width: 100%;
			height: 70rpx;
			background-color: #fff;
			
			.third-ipt {
				padding: 5px 10px;
				height: 70rpx;
				font-size: 14px;
			}
		}
	}
	
	.faq-btn {
		position: absolute;
		bottom: 0;
		width: 100%;
		height: 100rpx;
		line-height: 100rpx;
		text-align: center;
		background-color: #222222;
		color: #fff;
	}
</style>
